package uit.ce.hungtrung.game.lib.game2d;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;

public class Sprite {

	private Bitmap bmImage;
	private int width;
	private int height;
	private int x, y;

	public Sprite(Context context, int iImage) {
		bmImage = BitmapFactory.decodeResource(context.getResources(), iImage);
		this.width = bmImage.getWidth();
		this.height = bmImage.getHeight();
	}

	public void setPosition(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public void setX(int x) {
		this.x = x;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getWidth() {
		return this.width;
	}

	public int getHeight() {
		return this.height;
	}

	public void DrawIamge(Canvas canvas) {
		canvas.drawBitmap(bmImage, x, y, new Paint());

	}

	public boolean isCollition(float x, float y) {
		if (x < this.x || x > this.x + this.width || y < this.y
				|| y > this.y + this.height) {
			return false;
		}
		return true;
	}
}
